package com.blb.mapper;

import com.blb.entity.Logistics;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author HuaHao
 * @since 2019-11-16
 */
public interface LogisticsMapper extends BaseMapper<Logistics> {

    List<Logistics> findLogistics(@Param("logisticsName") String logisticsName);

    @Delete("DELETE FROM t_logistics WHERE logistics_id= #{id}")
    void deleteLogistics(String id);

    @Select("select remarks from t_logistics where logistics_id= #{id} ")
    String findRemarksById(String id);

    @Update("UPDATE t_logistics SET logistics_name=#{logistics.logisticsName}, principal=#{logistics.principal}, logistics_contact=#{logistics.logisticsContact}, area=#{logistics.area}, price=#{logistics.price}, remarks=#{logistics.remarks} WHERE logistics_id=#{logistics.logisticsId}")
    void update(@Param("logistics") Logistics logistics);

    @Select("SELECT * FROM t_logistics WHERE logistics_id=#{id}")
    Logistics findById(@Param("id") String id);
}
